import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    {
        path: '',
        redirect: '/page1'
    },
    {
        path: '/page1',
        components: {
            default: () => import('@/views/page1'),
            menu: () => import('@/views/menus/menu1')
        }
    },
    {
        path: '/page2',
        components: {
            default: () => import('@/views/page2'),
            menu: () => import('@/views/menus/menu2')
        }
    },
    {
        path: '/page3',
        components: {
            default: () => import('@/views/page2'),
            menu: () => import('@/views/menus/menu3')
        }
    },
    {
        path: '/page4',
        components: {
            default: () => import('@/views/page2'),
            menu: () => import('@/views/menus/menu4')
        }
    },
    {
        path: '/page5',
        components: {
            default: () => import('@/views/page2'),
            menu: () => import('@/views/menus/menu5')
        }
    }
]

const createRouter = () => new VueRouter({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: routes
})

const router = createRouter()

export default router